//
//  GoodStorysDetailTableViewCell.m
//  NBTripe
//
//  Created by Lee on 16/1/12.
//  Copyright © 2016年 Vicki. All rights reserved.
//

#import "GoodStorysDetailTableViewCell.h"

@implementation GoodStorysDetailTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.textlabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.picimageview = [[UIImageView alloc] initWithFrame:CGRectZero];
        [self addSubview:self.textlabel];
        [self addSubview:self.picimageview];
    }
    return self;
}
- (void)layoutSubviews {
    [super layoutSubviews];
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:14]};
    //图片位置
   [Convenience createCirCleImageView:self.picimageview WithFrame:CGRectMake(10*XWIDTH, 5*XHIGHT, WIDTH-20*XWIDTH, 180*XHIGHT) WithCorNerRadius:10];
    //日记自适应高度
    CGRect rect = [self.textlabel.text boundingRectWithSize:CGSizeMake(self.width-20, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    [Convenience createLabel:self.textlabel WithFrame:CGRectMake(10*XWIDTH, self.picimageview.bottom+10, WIDTH-20, rect.size.height+10) FrameWithTextColor:[UIColor darkGrayColor] TextColorWithFont:[UIFont systemFontOfSize:14] FontWithNSTextAlignment:NSTextAlignmentLeft TextAlignmentWithNumberOfLines:0 WithText:self.textlabel.text];
  
}
- (void)setDetailmodel:(GoodStoryDetailModel *)detailmodel {
    if (_detailmodel != detailmodel) {
        _detailmodel = detailmodel;
    }
    [self.picimageview sd_setImageWithURL:[NSURL URLWithString:_detailmodel.photo_w640] placeholderImage:[UIImage imageNamed:@"160.jpg"]];
    self.textlabel.text = detailmodel.text;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
